class Solution:
    def isPalindrome(self, s: str) -> bool:
        filtered = [x.lower() for x in s if x.isalnum()]
        left = 0
        right = len(filtered) - 1

        # closed interval
        while right >= left:
            if filtered[left] == filtered[right]:
                left += 1
                right -= 1
            else:
                return False
        return True